package func.study.designpattern.singleton;

/**
 * 使用惰性初始化holder类技巧实现单例模式
 * Created by chenyao on 2017/7/13.
 */
public class ResourceFactory {
    private static class ResourceHolder {
        public static final Resource resource = new Resource();
    }
    public static Resource getInstance() {
        return ResourceHolder.resource;
    }


    public static void main(String[] args) {
        ResourceFactory.getInstance();
        ResourceFactory.getInstance();
    }




}
